home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / Tools / fastread / FastRead.gc < prev    next >
Encoding:
Gui4CLI script  |  1999-11-24  |  3.6 KB  |  171 lines

  1. G4C
  2.  
  3. WINBIG 208 36 241 179 "FastRead.gc"
  4. wintype 11010001
  5. resinfo 8 640 256
  6. varpath "viewtext.g"
  7.  
  8. xonreload
  9.     guiopen fastread.gc
  10.  
  11. xonload
  12.     extract fastread.gc guipath fre_path
  13.     assign GCHELP: $fre_path
  14.     delvar fre_path
  15.     ttget gchelp:fastread.gc
  16.     guiload gchelp:viewtext.g
  17.     ifexists port AREXX
  18.         ;Nop
  19.     elseifexists file sys:system/rexxmast
  20.         run 'sys:system/rexxmast >nil:'
  21.     else
  22.         ezreq "Can't start ARexx" Okay ""
  23.         assign gchelp: remove
  24.         guiquit viewtext.g 
  25.         guiquit fastread.gc   
  26.     endif
  27.  
  28.     guide = $*FRGUIDE       ; change this 
  29.  
  30.     if $guide = ''
  31.         reqfile -1 -1 200 -60 'Select A Document' load guide GUIS:Docs
  32.         if $guide = ''
  33.            assign GCHELP: remove
  34.            guiquit viewtext.g 
  35.            guiquit fastread.gc   
  36.            stop
  37.         endif
  38.     endif
  39.  
  40.     extract guide file list
  41.     appvar list .idx
  42.     joinfile gchelp:idx $list list
  43.     ifexists file c:getnodes
  44.     andifexists file c:writenode
  45.         run 'resident c:getnodes pure add'
  46.         run 'resident c:writenode pure add'
  47.     elseifexists file guis:c/getnodes
  48.     andifexists file guis:c/writenode
  49.         run 'resident guis:c/getnodes pure add'
  50.         run 'resident guis:c/writenode pure add'
  51.     else
  52.         ezreq "Cannot Find Binaries." Okay ""
  53.         gosub fastread.gc exit
  54.     endif
  55.     ifexists file $list
  56.         ;nop
  57.     else
  58.         cli 'getnodes $guide $list'
  59.     endif
  60.     lvuse fastread.gc 1
  61.     lvchange $list
  62.     guiopen fastread.gc
  63.     extract guide file wtitle
  64.     extract wtitle unquote wtitle
  65.     setwintitle fastread.gc '$wtitle'
  66.  
  67.  
  68. xonkey #v
  69. xonkey #r
  70.     if $$rawkey.code = 95
  71.         cli 'writenode guis:docs/helpsystem.txt 8655 1826'
  72.         guiopen viewtext.g
  73.         set translation off
  74.         lvuse viewtext.g 1
  75.         lvchange ram:guide.txt
  76.     elseif $$rawkey.code = 78
  77.         lvuse fastread.gc 1
  78.         lvmove 1
  79.     elseif $$rawkey.code = 79
  80.         lvuse fastread.gc 1
  81.         lvmove -1
  82.     endif
  83.  
  84. xonclose
  85.     gosub fastread.gc exit
  86.  
  87. XTEXTIN 0 0 163 13 "" txt "" 80
  88.     attr resize 0020
  89.     gadhelp 'Enter text to search for'
  90.     if $txt > ''
  91.         lvuse fastread.gc 1
  92.         lvsearch $txt ci first
  93.     endif
  94.     gosub fastread.gc search_update
  95.  
  96. XBUTTON 164 0 19 13 ยป
  97.     attr resize 2000
  98.     gadhelp 'Find next..'
  99.     if $txt > ''
  100.        lvuse fastread.gc 1
  101.        lvsearch $txt ci next
  102.     endif
  103.     gosub fastread.gc search_update
  104.  
  105. XBUTTON 183 0 17 13 "R"        ; re-index the guide
  106.     attr resize 2000
  107.     gadhelp 'Re-Index guide (in case it has been edited)'
  108.     guiwindow fastread.gc wait
  109.     cli 'getnodes $guide $list'
  110.     lvuse fastread.gc 1
  111.     lvchange $list
  112.     guiwindow fastread.gc resume
  113.  
  114.  
  115. XBUTTON 200 0 40 13 Open
  116.     attr resize 2000
  117.     gadhelp 'Load an other guide'
  118.     reqfile -1 -1 200 -60 'Select A Guide:' load doc GUIS:Docs
  119.     ifexists file $doc
  120.         guide = $doc
  121.         extract guide file list
  122.         appvar list .idx
  123.         joinfile gchelp:idx $list list
  124.         ifexists file $list
  125.             ;nop
  126.         else
  127.             cli 'getnodes $guide $list'
  128.         endif
  129.         lvuse fastread.gc 1
  130.         lvchange $list
  131.         extract guide file wtitle
  132.         extract wtitle unquote wtitle
  133.         setwintitle fastread.gc '$wtitle'
  134.     endif
  135.  
  136. XLISTVIEW 0 13 240 166 '' topic '' 0 txt
  137.     attr resize 0022
  138.     gadid 1
  139.     gosub fastread.gc fetchtext
  140.     gadfont #mono 8 000
  141.  
  142. xroutine fetchtext
  143.     cutvar topic cut word -2 offset
  144.     extract topic upper topic
  145.     extract topic unquote topic
  146.     cli 'writenode $guide $offset'
  147.     guiopen viewtext.g
  148.     update viewtext.g 2 "Subject: $topic"
  149.     set translation off
  150.     lvuse viewtext.g 1
  151.     lvchange ram:guide.txt
  152.  
  153. xroutine search_update
  154.     if $$lv.line > ''
  155.        update fastread.gc 1 $$lv.line
  156.     else
  157.        lvgo #0
  158.        update fastread.gc 1 0
  159.     endif
  160.  
  161. xroutine exit
  162.     assign GCHELP: remove
  163.     run 'resident getnodes remove'
  164.     run 'resident writenode remove'
  165.     ifexists file ram:guide.txt
  166.         delete ram:guide.txt
  167.     endif
  168.     guiquit viewtext.g 
  169.     guiquit fastread.gc   
  170.    
  171.